<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_pick" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 选择工序 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="工序名称" prop="pick_pro">
              {{s_pick.pick_pro}}
              <el-button @click="popProductProLists('pick_pro','pick_pro')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </el-form>
    <el-dialog :visible.sync="ProductProListsVisible" append-to-body>
      <ProductProLists v-if="ProductProListsVisible" ref="ProductProLists" :popparams="popparams"> </ProductProLists>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductProLists from "@/views/mes/product/ProductProLists";
  export default {
    name: 'ProductChoice',
    components: {
      ProductProLists,
    },
    props: ['popparams'],
    data() {
      return {
        ProductProListsVisible: false,
        ProductProListsValue: null,
        ProductProListsDesc: null,
        vueparams: this.getVUEParams(""),
        s_pick: {
          pick_pro: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/ProcedureAction/productChoice?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popProductProLists(desc, value) {
        this.ProductProListsVisible = true;
        this.ProductProListsDesc = desc;
        this.ProductProListsValue = value;
      },
      closeProductProLists(value, desc) {
        this.ProductProListsVisible = false;
        this.$set(this.s_pick, this.ProductProListsDesc, desc);
        this.$set(this.s_pick, this.ProductProListsValue, value);
      },
    },
  }
</script>
